package com.demo.dao;

import com.demo.dao.mapper.SearchOfferMapper;
import org.apache.ibatis.session.SqlSession;

public class SpecifyOfferDetailDao extends BaseDao{
    private static final String ENVIRONMENT_CU = "CU";

    public OfferDetail selectOfferDetailFromInboxMessage(String personId, String campaign_subtype) {
        OfferDetail offerDetail = null;

        try (SqlSession session = openSession(ENVIRONMENT_CU)){
            SearchOfferMapper mapper = session.getMapper(SearchOfferMapper.class);
            offerDetail = mapper.getOfferDetailFromInboxMessage(personId, campaign_subtype);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return offerDetail;
    }

    public OfferDetail selectOfferDetailFromBanner(String personId, String campaign_subtype) {
        OfferDetail offerDetail = null;

        try (SqlSession session = openSession(ENVIRONMENT_CU)){
            SearchOfferMapper mapper = session.getMapper(SearchOfferMapper.class);
            offerDetail = mapper.getOfferDetailFromBanner(personId, campaign_subtype);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return offerDetail;
    }
}
